package com.sh169.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.tiles.TilesContainer;
import org.apache.tiles.access.TilesAccess;
import org.nutz.mvc.View;

public class TilesView implements View{

	private String viewName;
	
	public String getViewName() {
		return viewName;
	}
	public void setViewName(String viewName) {
		this.viewName = viewName;
	}
	public TilesView(){}
	public TilesView(String viewName){
		this.viewName = viewName;
	}
	@SuppressWarnings("deprecation")
	public void render(HttpServletRequest req, HttpServletResponse resp,
			Object obj) throws Throwable {
		req.setAttribute("obj", obj);
		TilesContainer tc = TilesAccess.getContainer(req.getSession().getServletContext());
		tc.render(viewName, req,resp);
	}

}
